<?php $this->layout='main'; ?>
<link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/jquery.tooltip.css" />
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.bgiframe.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.dimensions.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.tooltip.js"></script>

<link href="<?php echo Yii::app()->request->baseUrl; ?>/css/jquery.jscrollpane2.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.jscrollpane.min.js"></script>
<script type="text/javascript" id="sourcecode">
			$(function()
			{
				$('.scroll-pane-arrows4').jScrollPane(
					{
						showArrows: true,
						horizontalGutter: 10
					}
				);
			});
</script>

<script>
var previousActiveAuctionID=0;//most recently active auctions;
var previousColumnID=0;//most recently bid auctions;
var previousOrderID=0;//most recently open orders
var previousHistoryID=0;//most recently auction history

function updateTables()
{
	$.fn.yiiGridView.update('activeauctionsTable');
	$.fn.yiiGridView.update('openordersTable');
	$.fn.yiiGridView.update('auctionhistoryTable');
}
/*
 * element: the tab link
 * tag: supposed class name of the link
 * focus on that tab link
 */
function activateTab(element, tag)
{
	var elementList=$("[name='tabs']");
	for(var i=0;i<elementList.length;i++)
	{
		if(elementList[i]==element.parentNode)//activate it
		{
			elementList[i].className=tag+(i+1)+" "+tag+"-active"+(i+1);
		}
		else
		{
			elementList[i].className=tag+(i+1);
		}
	}
}

/*
* param: the tab link user clicked
* focus on the active auctions tab
* display the content under the active auctions tab
*/
function displayActiveAuctions(element)
{
	activateTab(element, 'aa');
	var activeAuctionsArea = document.getElementById('active-auctions-area');
	activeAuctionsArea.style.display='block';
	var activeAuctionsDetails = document.getElementById('active-auctions-details');
	activeAuctionsDetails.style.display='block';
	document.getElementById('aa-place-order').style.display='block';
	document.getElementById('active-auction-market').style.display='block';
	
	var openordersArea = document.getElementById('open-orders-area');
	openordersArea.style.display='none';
	var openordersDetails = document.getElementById('open-orders-details');
	openordersDetails.style.display='none';
//	document.getElementById('aa-sd-button').style.display='none';
	document.getElementById('open-orders-market').style.display='none';
	
	var auctionhistoryArea = document.getElementById('auction-history-area');
	auctionhistoryArea.style.display='none';
	var auctionhistoryDetails = document.getElementById('auction-history-details');
	auctionhistoryDetails.style.display='none';
	document.getElementById('auction-history-market').style.display='none';
	
	document.getElementById('BidAuctionTable').innerHTML='';
}

/*
* param: the tab link user clicked
* focus on the open orders tab
* display the content under the open orders tab
*/
function displayOpenOrders(element)
{
	activateTab(element, 'aa');

	clearAuctionDetails();
	var activeAuctionsArea = document.getElementById('active-auctions-area');
	activeAuctionsArea.style.display='none';
	var activeAuctionsDetails = document.getElementById('active-auctions-details');
	activeAuctionsDetails.style.display='none';
	document.getElementById('aa-place-order').style.display='none';
	document.getElementById('active-auction-market').style.display='none';
	
	var openordersArea = document.getElementById('open-orders-area');
	openordersArea.style.display='block';
	var openordersDetails = document.getElementById('open-orders-details');
	openordersDetails.style.display='block';
//	document.getElementById('aa-sd-button').style.display='block';
	document.getElementById('open-orders-market').style.display='block';
	
	var auctionhistoryArea = document.getElementById('auction-history-area');
	auctionhistoryArea.style.display='none';
	var auctionhistoryDetails = document.getElementById('auction-history-details');
	auctionhistoryDetails.style.display='none';
	document.getElementById('auction-history-market').style.display='none';
}

/*
* param: the tab link user clicked
* focus on the auction history tab
* display the content under the auction history tab
*/
function displayAuctionHistory(element)
{
	clearAuctionDetails();
	activateTab(element, 'aa');
	var activeAuctionsArea = document.getElementById('active-auctions-area');
	activeAuctionsArea.style.display='none';
	var activeAuctionsDetails = document.getElementById('active-auctions-details');
	activeAuctionsDetails.style.display='none';
	document.getElementById('aa-place-order').style.display='none';
	document.getElementById('active-auction-market').style.display='none';
	
	var openordersArea = document.getElementById('open-orders-area');
	openordersArea.style.display='none';
	var openordersDetails = document.getElementById('open-orders-details');
	openordersDetails.style.display='block';
//	document.getElementById('aa-sd-button').style.display='none';
	document.getElementById('open-orders-market').style.display='none';
	
	var auctionhistoryArea = document.getElementById('auction-history-area');
	auctionhistoryArea.style.display='block';
	var auctionhistoryDetails = document.getElementById('auction-history-details');
	auctionhistoryDetails.style.display='block';
	document.getElementById('auction-history-market').style.display='block';
}

/*
* create a new tooltip,
* display the site details info in the tooltip,
* after changing the selected auction
*/
function updateSiteDetails(data)
{
	var result='';
	
	var tank=data[0];
	var site=data[1];
	var rack=data[2];
	var tools=data[3];
	var tankType=data[4];
	var tankPosition=data[5];
	var tankMonitor=data[6];
	
	result+='<b>SITE ID:</b> '+site.site_ID+'</br>';
	result+='<b>SITE NAME:</b> '+site.site_name+'</br>';
	result+='<b>Address 1:</b> '+site.address1+'</br>';
	result+='<b>Address 2:</b> '+site.address2+'</br>';
	result+='<b>City/State/Zip:</b> '+site.city+', '+site.state+', '+site.zip+'</br>';
	result+='<b>County:</b> '+site.county+'</br>';
	result+='<b>Home Rack:</b> '+rack.city+', '+rack.state+'</br>';
	if(site.gated==1)
	{
		result+='<b>Gated:</b> YES</br>';
		result+='<b>Gated Hours:</b> '+site.gate_opens+'-'+site.gate_closes+'</br>';
	}
	else
	{
		result+='<b>Gated:</b> NO</br>';
	}
	if(site.security_on_premises==1)
	{
		result+='<b>Hour of Operations:</b> '+site.open_time+'-'+site.close_time+'</br>';
	}
	for(var i=0;i<tools.length;i++)
	{
		result+='<b>'+tools[i].tool_name+':</b> YES</br>';
	}
	result+='</br>';
	
	result+='<b>TANK ID:</b> '+tank.tank_ID+'</br>';
	result+='<b>TANK NAME:</b> '+tank.tank_name+'</br>';
	result+='<b>Type of Tank:</b> '+tankType.tank_type_description+'</br>';
	result+='<b>Orientation:</b> '+tankPosition.tank_position_description+'</br>';
	if(tankMonitor!=null)
	{
		result+='<b>Tank Monitor MFG:</b> '+tankMonitor.monitor_MFG+'</br>';
		result+='<b>Tank Monitor Model:</b> '+tankMonitor.monitor_model+'</br>';
	}
	if(tank.remote_fill==1)
	{
		result+='<b>Remote Fill:</b> YES</br>';
	}
	if(tank.overfill_alarm==1)
	{
		result+='<b>Overfill Alarm:</b> YES</br>';
	}
	result+='</br>';
	
	result+='<b>Contact Name:</b> '+site.contact_name+'</br>';
	result+='<b>Phone# of Site:</b> '+site.phone_number_of_site+'</br>';
	result+='<b>After Hour #:</b> '+site.after_hour_number+'</br>';
	
	$("#site-details-button").tooltip({
    	bodyHandler: function() {
	     return result;
	   },
	   showURL: false
    });
}

/*
* update info of the current auction bids situation,
* retrieve site details,
* after changing the selected auction in active auctions
*/
function updateBidsTables(data)
{
	if(data!=null)
	{
		var element = document.getElementById('active-auctions-details');
		element.innerHTML = data[0];//display the bidder response table
		//modify winning bid price
		//document.getElementById('cwb-bidder').innerHTML='Bidder '+data[1];
		if(data[2]!=null)//the minimal bid price
			document.getElementById('cwb-amount').innerHTML='$'+data[2];
		if(data[3]!=null)//current minimal price among racks
			document.getElementById('market-c-price').innerHTML='$'+data[3];
		//update the site details
		var siteID=data[5];
		var tankID=data[4];
		$.ajax({
	       url: '<?php echo CController::createUrl('auctions/siteDetails');?>',
	       type: 'post',
	       dataType: 'json',
	       data: {site_ID:siteID, tank_ID:tankID},
	       success: updateSiteDetails
	     });
	}
}

/*
* show bid response info
*/
function showBidResponse(data)
{
	if(data!=null)
	{
		$('.black-overlay').toggle();
		$('.white-content').toggle();
		$('input').attr("disabled", true);
		$("input[name=auction-id]").val(data['auction_ID']);
		$("input[name=buyer]").val(data['name']);
		$("input[name=delivery-date]").val(data['delivery_due_date']);
		$("input[name=delivery-time]").val(data['delivery_due_time']);
		$("input[name=gallons]").val(data['gallon']);
		$("input[name=fuel-cost]").val(data['fuel_cost_per_gallon']);
		$("input[name=freight-cost]").val(data['freight_cost_per_gallon']);
		$("input[name=ancillary-fees]").val(data['ancillary_fees']);
		$("input[name=federal-tax]").val(data['fed_excise_tax']);
		$("input[name=federal-lust]").val(data['fed_lust']);
		$("input[name=federal-oil]").val(data['fed_oil_spill_fee']);
		$("input[name=nc-road]").val(data['nc_road_tax']);
		$("input[name=nc-wholesale]").val(data['nc_wholesale']);
		$("input[name=nc-inspection]").val(data['nc_inspection']);
		$("input[name=nc-tare]").val(data['nc_tare']);
		$("input[name=delivered-price]").val(data['delivered_price_per_gallon']);
	}
}

/*
* close bid response window
*/
function closeBidResponse() {
	$('.black-overlay').toggle();
	$('.white-content').toggle();
	$('input').attr("disabled", false);
}

/*
* display the new selected auction info 
*/
function updateAuctionInfo(data)
{
	if(data!=null)
	{
		var auction=data[0];
		var product=data[1];
		var tank=data[2];
		var table = document.getElementById('oo-details');
		table.children[0].innerHTML='<b>Auction ID:</b> '+auction.auction_ID;//auction ID
		table.children[1].innerHTML='<b>Product:</b> '+product.product_name;//product name
		table.children[2].innerHTML='<b>Gallons Req.:</b> '+auction.gallon;// gallons
		table.children[3].innerHTML='<b>Inv. Last Read:</b> '+tank.inventory_last_read;//inventory last read
		table.children[4].innerHTML='<b>Inv. Last Time:</b> '+tank.inventory_last_time;//inventory last time
		table.children[5].innerHTML='<b>Auction Start Date/Time:</b> '+auction.auction_start;//auction start time
		table.children[6].innerHTML='<b>Auction End Date/Time:</b> '+auction.auction_end;//auction end time
		table.children[7].innerHTML='<b>Delivery Requested Date/Time:</b> '+auction.delivery_due;//delivery due time
	}
}

/*
* update all grids after place order operation succeeds
* print errors when fails
*/
function updateOpenOrders(data)
{
	var tabs=document.getElementsByName('tabs');
	if(data=='place-order-success')
	{
		$('#msg-header').show();
		$('#msg-header').html('Order placed successfully.');
		updateTables();
		tabs[1].firstChild.click();
	}
	else
	{
		alert('You have already placed this order.');
	}
}

/*
* update all grids after close order operation succeeds
* print errors when fails
*/
function updateCloseOrders(data)
{
	var tabs=document.getElementsByName('tabs');
	if(data=='close-order-success')
	{
		document.getElementById('error-area').innerHTML='';
		$('#msg-header').show();
		$('#msg-header').html('Order has been closed. Please wait for supplier confirmation.');
		updateTables();
		tabs[2].firstChild.click();
	}
	else
	{
		for(var key in data)
		{
			document.getElementById('error-area').innerHTML+=data[key]+'</br>';
		}
	}
}

/*
* confirm with the user, send ajax request
* when click on place order button
*/
function clickOnPlaceOrder()
{
	var message='';
	if(previousColumnID==0)
	{
		message+='You didn\'t select a bidder.';
	}
	else
	{
		message+='Are you going to place the order offerred by the bidder '+previousColumnID.split(',')[0]+'?';
	}
	var placeOrder=window.confirm(message);
	if(placeOrder)
	{
		$.ajax({
	       url: '<?php echo CController::createUrl('auctions/insertOrder');?>',
	       type: 'post',
	       dataType: 'json',
	       data: {user_ID:previousColumnID.split(',')[0], auction_ID:previousColumnID.split(',')[1]},
	       success: updateOpenOrders
	     });
		return false;
	}
	else
	{
		return false;
	}
}

/*
* confirm with the user, send ajax request
* when click on close order button
*/
function clickOnCloseOrder()
{
	var message='';
	if(previousOrderID==0)
	{
		message+='You didn\'t select an order.';
	}
	else
	{
		message+='Are you going to close the order whose ID is '+previousOrderID+'?';
	}
	var closeOrder=window.confirm(message);
	if(closeOrder)
	{
		$.ajax({
	       url: '<?php echo CController::createUrl('auctions/closeOrder');?>',
	       type: 'post',
	       dataType: 'json',
	       data: {order_ID:previousOrderID, net_gallons:document.getElementById('net_gallons').value, gross_gallons:document.getElementById('gross_gallons').value},
	       success: updateCloseOrders
	     });
		return false;
	}
	else
	{
		return false;
	}
}

function selectItem() {
	$('#msg-header').hide();
	$('#msg-header').html('');
}

function clearAuctionDetails() {
	$('#oo-details').html("<p><b>Auction ID:</b></p><p><b>Product:</b></p><p><b>Gallons Req.:</b></p><p><b>Inv. Last Read:</b></p><p><b>Inv. Last Time:</b></p><p><b>Auction Start Date/Time:</b></p><p><b>Auction End Date/Time:</b></p><p><b>Delivery Requested Date/Time:</b></p>");
}
</script>

<div id="active-auction-bg">
<div class="ap-head">my auctions</div>

<div id="active-auctions">

<div id="aa-menu">
<div class="aa-navi">
    <ul>
        <li name='tabs' class="aa1 aa-active1"><?php echo CHtml::link('Active Auctions','#', array(
									'title' => 'Active Auctions',
									'onclick' => 'displayActiveAuctions(this)',
											)); ?></li>
        <li name='tabs' class="aa2"><?php echo CHtml::link('Open Orders','#', array(
									'title' => 'Open Orders',
									'onclick' => 'displayOpenOrders(this)',
											)); ?></li>
        <li name='tabs' class="aa3"><?php echo CHtml::link('Auction History','#', array(
									'title' => 'Auction History',
									'onclick' => 'displayAuctionHistory(this)',
											)); ?></li>
    </ul>
</div>
</div><!-- End Mybids Menu -->

<div id="active-auctions-contents">

<div class="scroll-pane-arrows4">
<div class="active-a-cont">

<div id='active-auctions-area' style="display:block">
<?php
	//active auction table
	$this->widget('zii.widgets.grid.CGridView', array(
	    'dataProvider'=>$activeauctionsDataProvider,
	    'id'=>'activeauctionsTable',
	    'selectableRows'=>1,
	    'selectionChanged'=>'function(id) {
	    		selectItem();
	    		var columnID = $.fn.yiiGridView.getSelection(id);
	    	    if(columnID[0]!=null)previousActiveAuctionID=columnID[0];
	    	    $.get(
	    			"'.$this->createUrl('auctions/bidAuctions').'",
	    			{ auction_ID: previousActiveAuctionID },
	    			function(data){
	    				updateBidsTables(data);
	    			},
	    			"json"
	    		);
	    }',
		'cssFile'=>Yii::app()->request->baseUrl.'/css/gridview.css',
	    'columns'=>array(
	        array(
	        	'name'=>'site',
	        	'value'=>'$data->site->site_name',
	        ),
	        array(
	        	'name'=>'tank',
	        	'value'=>'$data->tank->tank_name',
	        ),
	        array(
	        	'name'=>'product',
	        	'value'=>'$data->product->product_name',
	        ),
	        array(
	        	'name'=>'gallons',
	        	'value'=>'$data->gallon',
	        ),
	        array(
	        	'name'=>'ends at',
	        	'value'=>'date("Y-m-d g:ia", strtotime($data->auction_end))',
	        ),
    	),
	)
);	
?>
</div>

<div id='open-orders-area' style="display:none">
<?php
	//open orders table
	$this->widget('zii.widgets.grid.CGridView', array(
	    'dataProvider'=>$openordersDataProvider,
	    'id'=>'openordersTable',
	    'selectableRows'=>1,
	    'selectionChanged'=>'function(id) {
	    		selectItem();
	    		var columnID = $.fn.yiiGridView.getSelection(id);
	    	    if(columnID[0]!=null)previousOrderID=columnID[0];
	    	    $.get(
	    			"'.$this->createUrl('auctions/openOrders').'",
	    			{ order_ID: previousOrderID },
	    			function(data){
	    				updateAuctionInfo(data);
	    			},
	    			"json"
	    		);
	    }',
		'cssFile'=>Yii::app()->request->baseUrl.'/css/gridview.css',
	    'columns'=>array(
	        array(
	        	'name'=>'site',
	        	'value'=>'$data->auction->site->site_name',
	        ),
	        array(
	        	'name'=>'tank',
	        	'value'=>'$data->auction->tank->tank_name',
	        ),
	        array(
	        	'name'=>'product',
	        	'value'=>'$data->auction->product->product_name',
	        ),
	        array(
	        	'name'=>'gallons',
	        	'value'=>'$data->auction->gallon',
	        ),
    	),
	)
);	
?>
</div>

<div id='auction-history-area' style="display:none">
<?php
	//action history table
	$this->widget('zii.widgets.grid.CGridView', array(
	    'dataProvider'=>$auctionhistoryDataProvider,
	    'id'=>'auctionhistoryTable',
	    'selectableRows'=>1,
	    'selectionChanged'=>'function(id) {
	    		selectItem();
	    		var columnID = $.fn.yiiGridView.getSelection(id);
	    	    if(columnID[0]!=null)previousHistoryID=columnID[0];
	    	    $.get(
	    			"'.$this->createUrl('auctions/auctionHistory').'",
	    			{ auction_ID: previousHistoryID },
	    			function(data){
	    				updateAuctionInfo(data);
	    			},
	    			"json"
	    		);
	    }',
		'cssFile'=>Yii::app()->request->baseUrl.'/css/gridview.css',
	    'columns'=>array(
	        array(
	        	'name'=>'site',
	        	'value'=>'$data->site->site_name',
	        ),
	        array(
	        	'name'=>'tank',
	        	'value'=>'$data->tank->tank_name',
	        ),
	        array(
	        	'name'=>'product',
	        	'value'=>'$data->product->product_name',
	        ),
	        array(
	        	'name'=>'gallons',
	        	'value'=>'$data->gallon',
	        ),
    	),
	)
);	
?>
</div>

</div><!-- End Active A Contents -->
</div><!-- End scroll-pane-arrows4 -->

</div><!-- End Active Auctions Contents -->
</div><!-- End Active Auctions -->

<div id="aa-details">
<div id="aa-sd-button" style='display:block'>
<a id='site-details-button' href="#">
	<img src="<?php echo Yii::app()->request->baseUrl; ?>/images/site-details2.gif" alt="" />
</a>
</div>
<div id="aa-d-head">details</div>

<!--<div id="aa-d-text">-->
	<div id='active-auctions-details' style='display:block'>
		<div id="BidAuctionTable" class="grid-view">
		</div><!-- hold this to activate the jquery functions -->
	</div>
	
	<div id='open-orders-details' style='display:none'>
		<div id="oo-details">
		    <p><b>Auction ID:</b></p>
		    <p><b>Product:</b></p>
		    <p><b>Gallons Req.:</b></p>
		    <p><b>Inv. Last Read:</b></p>
		    <p><b>Inv. Last Time:</b></p>
		    <p><b>Auction Start Date/Time:</b></p>
		    <p><b>Auction End Date/Time:</b></p>
		    <p><b>Delivery Requested Date/Time:</b></p>
		</div><!-- End Open Order Details -->
	</div>
	
	<div id='auction-history-details' style='display:none'>
	</div>
	
<!--</div>-->
<!-- End AA D Text -->

<div id="aa-place-order">
	<?php
		$imageURI = "<img src='".Yii::app()->request->baseUrl."/images/place-order2.gif' />";
        echo CHtml::link($imageURI,'#', array(
									'onclick'=>'return clickOnPlaceOrder();'
								));
	?>
</div>
</div><!-- End AA Details -->
		
<div id="cwb">
<div id="cwb-head">Current Winning Bid</div>

<div id="cwb-amount"></div>
<div id="cwb-text">per gallon</div>
<div id="cwb-bidder"></div>

</div><!-- End Current Winning Bid -->
<div id='active-auction-market' style='display:block'>
	<div id="the-market">
	
	    <div id="market-head">the market</div>
	    
	    <div id="market-contnets">
	    <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/m-graph.gif" alt="" />
	    </div>
	</div><!-- End The Market -->

	<div id="market-cart">
		<div id="market-top">	
	        <div id="market-logo"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/m-logo.gif" alt="" /></div>
	        <div id="market-p-text">Price of Today</div>
	    </div>
	    <div id="market-c-indicator"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/down-arrow.gif" alt="" /></div>
	    <div id="market-c-price"></div>
	    <div id="market-c-text">per gallon</div> 
	</div><!-- End Market Cart -->
</div>

<div id='open-orders-market' style='display:none'>
<div id="the-market">
    <div id="market-head">&nbsp;</div>
    <div id='error-area' style='color:#FF0000'></div>
    <div id="net-gross">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <th width="120">net gallons</th>
          <td><div class="textbox2">
          	<?php echo CHtml::textField('net_gallons', ''); ?>
          </div></td>
        </tr>
        <tr>
          <th>gross gallons</th>
          <td><div class="textbox2">
          	<?php echo CHtml::textField('gross_gallons', ''); ?>
          </div></td>
        </tr>
      </table>
    </div>

	</div><!-- End The Market -->
	
	<div id="market-cart">
<!--	
	<div id="making-sure">
	<div id="ms-close"><a href="#"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/close.gif" alt="" /></a></div>
	    <div id="ms-values">
	    <table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
	    <th width="70">net gallons</th>
	    <td>1000</td>
	  </tr>
	  <tr>
	    <th>gross gallons</th>
	    <td>2000</td>
	  </tr>
	</table>
	</div>
	</div>
-->	    
	<div id="close-order">
		<?php
			$imageURI = "<img src='".Yii::app()->request->baseUrl."/images/close-order.gif' />";
	        echo CHtml::link($imageURI,'#', array(
										'onclick'=>'return clickOnCloseOrder();'
									));
		?>
	</div><!-- End Market Cart -->

</div>

<div id='auction-history-market' style='display:none'>
</div>

<div id="winner-ch">Winner Character</div>
<div id="cart-ch">Cart Character</div>

</div><!--  End Open Orders Market -->

<div class="black-overlay" onclick="closeBidResponse()"></div>
<div class="white-content">
	<div style="cursor: pointer; color: #000; position: absolute; right: 10px; z-index: 100;" onclick="closeBidResponse()">Close [X]</div>
	<?php include_once('response-info.php'); ?>
</div>

</div><!-- End Active Auction Bg -->

<script type="text/javascript">
/*
* the jquery function that sends ajax request to retrieve bid response table by given auction ID and user ID
*/
jQuery(function($) {
jQuery('#BidAuctionTable').yiiGridView({'ajaxUpdate':['BidAuctionTable'],'ajaxVar':'ajax','pagerClass':'pager','loadingClass':'grid-view-loading','filterClass':'filters','tableClass':'items','selectableRows':1,'pageVar':'BidAuctions_page','selectionChanged':function(id) {
	    		var columnID = $.fn.yiiGridView.getSelection(id);
	    		if(columnID[0]!=null)previousColumnID=columnID[0];
	    	    $.get(
	    			"<?php echo Yii::app()->request->baseUrl; ?>/auctions/bidResponse",
	    			{ user_ID: previousColumnID.split(',')[0], auction_ID: previousColumnID.split(',')[1] },
	    			function(data){
	    				showBidResponse(data);
	    			},
	    			"json"
	    		);
	    }});
});
</script>
